<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@page import="org.jasig.cas.client.authentication.AttributePrincipal" %>
<%@page import="java.util.*" %>
<%@page import="java.util.Map.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
  </head>
  
  <body>
   	 这是客户端首页cas-client2 <br>
    <%

   AttributePrincipal  principal= (AttributePrincipal)request.getUserPrincipal();   
    /*   Map<String,Object> attributes = principal.getAttributes();
	
	Object userInfo =attributes.get("userinfo");
	if(null != attributes){
		Set<Entry<String, Object>> set = attributes.entrySet();
		Iterator<Entry<String, Object>>  it = set.iterator();
		while(it.hasNext()){
			Entry<String, Object> entry = it.next();
			String key = entry.getKey();
			String value = entry.getValue().toString();
			System.out.println(key+"="+value);
		}
	}
	 */
	
	
	String username = "";
   if(null!=principal){

      username=principal.getName();

   %>

   <h1>登录成功，这是cas-celient2</h1><br/>

   用户名：<%=username %><br/>

  

   <a href="logout.jsp">退出</a><br>

  <% 

   }

   %>
  </body>
</html>
